package com.lang.datasource.controller;

import com.lang.datasource.service.DatasourceService;
import com.lang.dto.datasource.BaseDataSourceDto;
import com.lang.dto.datasource.MysqlDto;
import com.lang.response.ResponseResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * creat by SimonLang
 * 2022/12/31 14:21
 */

@RestController
@RequestMapping("/datasource/mysql")
public class MysqlController {

    @Resource
    DatasourceService datasourceService;

    /**
     * Mysql数据源预连接
     * @param mysqlDto
     * @return
     */
    @ResponseResult
    @PostMapping(value = "/preconnect",produces = "application/json")
    public BaseDataSourceDto preconnect(@RequestBody MysqlDto mysqlDto){
        return datasourceService.preconnect(mysqlDto);
    }
}

